package com.itheima.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo02 {

    public static void main(String[] args) {
        Collection<String> collection=new ArrayList<>();
        collection.add("蔡徐坤");
        collection.add("鹿晗");
        collection.add("张艺兴");
        collection.add("黄子韬");
        collection.add("吴签");

        //获取迭代器 iterator
        Iterator<String> iterator = collection.iterator();
        /*boolean b = iterator.hasNext();
        String next = iterator.next();*/
        while (iterator.hasNext()){
            String s = iterator.next();
            System.out.println(s);
        }
    }
}
